{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Linear regression\n",
    "\n",
    "\n",
    "In this notebook, we perform linear regression to try and predict the winning time of the mens 100m sprint at the 2012 Olympics, using historical winning times.\n",
    "\n",
    "Our aim is to use linear regression (one of the simplest models we might use) to demonstrate the whole Machine Learning process: defining a model, optimising the parameters of that model from data (*learning*) and then evaluating the model's performance.\n",
    "\n",
    "We start by loading the Olympic 100m men's data from the URL below and then copying the first and second columns into the numpy variables x and t."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "from IPython.display import IFrame\n",
    "import urllib\n",
    "# You only need this line if you haven't cloned the repo...if you have cloned, you'll already have the data\n",
    "urllib.urlretrieve('https://raw.githubusercontent.com/sdrogers/fcmlcode/master/notebooks/data/olympic100m.txt', 'olympic100m.txt')\n",
    "import numpy as np\n",
    "# If you have cloned, make sure this is pointing to the correct file, maybe ../data/olympic100m.txt ?\n",
    "data = np.loadtxt('olympic100m.txt',delimiter=',')\n",
    "x = data[:,0][:,None]\n",
    "t = data[:,1][:,None]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Plotting\n",
    "\n",
    "\n",
    "It's always useful to start with a plot of the data. I'm using matplotlib but you can use other things too.\n",
    "\n",
    "Note the *magic* command `%matplotlib inline` which tells the notebook to render the plots in the browser and not to file."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[<matplotlib.lines.Line2D at 0x110e95750>]"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAhoAAAFkCAYAAABmeZIKAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAAPYQAAD2EBqD+naQAAIABJREFUeJzt3X90XGd95/H3V0RAbYTDaTYJu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qco3w0zpLroZmV9Pz8D+ahip8/ydefC/wx8I38\npPBF4A0Vx3gy8JdkzaMzwGeBX67Y5mzgg2RJ9XvAHwHLmv0mWWRd/CZZZ68f5m+abVQMPyTrPf4H\nZMPVZvJ6Obdim1Vk46G/n/9R/R75B3Ar/Cy1HvL9K/edO94T26Ue6vWeqHLMhzh1GHlL10W96gH4\nLbIWjBng08DqivUtfZ6o0zmiU86X1erhIeBVZdvU5XyY1/skWQvpvwC/0uzXX896IOskXe0YX61n\nPTipmiRJKkyr9tGQJEkdwKAhSZIKY9CQJEmFMWhIkqTCGDQkSVJhDBqSJKkwBg1JklQYg4YkSSqM\nQUOSJBXGoCFJkgpj0JAkSYX5/ydlo1dBIsCwAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x110d58d50>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "import pylab as plt\n",
    "%matplotlib inline\n",
    "plt.plot(x,t,'ro')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Minismising the loss\n",
    "\n",
    "Recall that the total loss was given by:\n",
    "\n",
    "$$ L = \\frac{1}{N}\\sum_{n=1}^N (t_n - w_0 - w_1x_n)^2 $$\n",
    "\n",
    "which can be interpreted as the total squared error between the data ($t_n$) and the model's prediction ($w_0+w_1x_n$).\n",
    "\n",
    "One way of defining the **best** model is that one that minimises this error (i.e. the values of $w_0$ and $w_1$ that make $L$ as small as possible). \n",
    "\n",
    "To find a minimum we can differentiate the expression with respect to $w_0$ and $w_1$, set the resulting equations to zero and then solve (at a minimum (or maximum) the gradient must be zero).\n",
    "\n",
    "I'll do this in class, but here is a sketch of it:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "        <iframe\n",
       "            width=\"600\"\n",
       "            height=\"300\"\n",
       "            src=\"lin_reg_diff.pdf\"\n",
       "            frameborder=\"0\"\n",
       "            allowfullscreen\n",
       "        ></iframe>\n",
       "        "
      ],
      "text/plain": [
       "<IPython.lib.display.IFrame at 0x111120450>"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "IFrame('lin_reg_diff.pdf',width=600,height=300)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "the result is that the loss is minimised by:\n",
    "\n",
    "$$ w_1 = \\frac{\\bar{x}\\bar{t} - \\bar{xt}}{\\bar{x}\\bar{x} - \\bar{x^2}} $$\n",
    "\n",
    "and\n",
    "\n",
    "$$ w_0 = \\bar{t} - w_1\\bar{x} $$\n",
    "\n",
    "where $\\bar{z} = \\frac{1}{N}\\sum_{n=1}^N z_n$\n",
    "\n",
    "We can now compute these quantites, first computing all the mean values we need:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1952.37037037\n",
      "10.3896296296\n",
      "3812975.55556\n",
      "20268.0681481\n"
     ]
    }
   ],
   "source": [
    "xbar = x.mean()\n",
    "tbar = t.mean()\n",
    "xxbar = np.multiply(x,x).mean()\n",
    "xtbar = np.multiply(x,t).mean()\n",
    "print(xbar)\n",
    "print(tbar)\n",
    "print(xxbar)\n",
    "print(xtbar)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "And now using these to compute $w_0$ and $w_1$:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "36.4164559025\n",
      "-0.013330885711\n"
     ]
    }
   ],
   "source": [
    "w1 = (tbar*xbar - xtbar)/(xbar*xbar - xxbar)\n",
    "w0 = tbar-w1*xbar\n",
    "print(w0)\n",
    "print(w1)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Plotting\n",
    "\n",
    "Now that we have $w_0$ and $w_1$ we can plot the data.\n",
    "\n",
    "Note that the way I do this below, is a bit of an overkill but, once we move to nonlinear regression (non-straight lines) we will need to do things this way..."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.text.Text at 0x111169310>"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAi8AAAF5CAYAAABX68ozAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAAPYQAAD2EBqD+naQAAIABJREFUeJzs3Xd4leX9x/H392gcYETrLqIJzogTcMQ9UHAQB3ag1r2q\nGAva2l+hggq1tY6iota6F9qKIyDDXSsianAbB0oqouIsRBwEzvf3x33iOYQkJCdnPcnndV3PZfKs\nc5/b5OTD/dzD3B0RERGRqIjluwAiIiIibaHwIiIiIpGi8CIiIiKRovAiIiIikaLwIiIiIpGi8CIi\nIiKRovAiIiIikaLwIiIiIpGi8CIiIiKRovAiIiIikVIQ4cXM9jKzKjObZ2ZxM6tIObaymf3FzF4z\ns28S59xuZhu14r5nm9kcM/vOzJ43s52z+05EREQk2woivABdgVeAs4HGiy11AXYELgJ2Ao4EtgIe\nbumGZvYL4ApgZOK6V4FpZrZuRksuIiIiOWWFtjCjmcWBI9y9qoVz+gIzgU3d/aNmznkemOnu5ya+\nN2AucLW7X5b5kouIiEguFErLS1utRWih+V9TB82sCOgDPNGwz0NKexwoz0UBRUREJDsiF17MbFXg\nz8A97v5NM6etC6wEzG+0fz6wYRaLJyIiIlm2cr4L0BZmtjLwL0Kry1np3ILl+9Q03HsdoD9QC3yf\nZhFFREQ6o9WAEmCau3+Z7ReLTHhJCS49gP1baHUB+AJYCmzQaP/6LN8a06A/cHd7yykiItKJHQvc\nk+0XiUR4SQkuPYH93P3rls5393ozqwYOAKoS97DE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ga+BiRFRb2SkkfbGkCbfDoqIn/5re90c63LSCqY9evM4ZtY7/KmPZtaQ/Phk\nM+B80mOUmauv0VjzTWxr1calDYBtSfNdLunNY5lZ73HwYmaNGkr63JeFpFGXria23dtDwXcAx5Mm\n6TZrkrGZ/c/82MjMzMwqxRN2zczMrFIcvJiZmVmlOHgxMzOzSnHwYmZmZpXi4MXMzMwqxcGLmZmZ\nVYqDFzMzM6sUBy9mZmZWKX8BUk+mGtVpVNgAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x110fdf990>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "x_test = np.linspace(1896,2008,100)[:,None]\n",
    "f_test = w0+w1*x_test\n",
    "plt.plot(x_test,f_test,'b-',linewidth=2)\n",
    "plt.plot(x,t,'ro')\n",
    "plt.xlabel('Olympic year')\n",
    "plt.ylabel('Winning time (s)')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Phew - it looks like a *good* model!"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Predictions\n",
    "\n",
    "We can now compute the prediction at 2012 by plugging in $x=2012$ into the model:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "9.59471385205\n"
     ]
    }
   ],
   "source": [
    "win_2012 = w0+w1*2012\n",
    "print(win_2012)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "So, we predict that the winning time will be 9.5947... seconds..."
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.10"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
